import fetch from 'common/src/utils/fetch';
function checkCourseMessage(code) { // 课程信息查询
    return fetch({
        url: '/api/scoremanagementservice/ScoreCourseWhiteBachelor/selectCourseInfo?code=' + code,
        method: 'get',

    });
}

function getPartPublicCourseList(data) { // 部分发布课程查询
    return fetch({
        url: '/api/scoremanagementservice/ScoreCourseWhiteBachelor/selectScoreCourseWhiteBachelor',
        method: 'post',
        data
    });
}
function addPartPublicCourseList(data) { // 部分发布课程添加
    return fetch({
        url: '/api/scoremanagementservice/ScoreCourseWhiteBachelor/saveScoreCourseWhiteBachelor',
        method: 'post',
        data
    });
}
function deletePartPublicCourseList(data) { // 部分发布课程删除
    return fetch({
        url: '/api/scoremanagementservice/ScoreCourseWhiteBachelor/delScoreCourseWhiteBachelor',
        method: 'delete',
        data
    });
}

/**
 * 获取排考课程信息
 * @param {*} data
 */
function findCourseList(data) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseManageController/queryScoreCourseManage',
        method: 'post',
        data
    });
}

/**
 * 模糊查询课程
 * @param data
 */
function findCourseNameOrCodeList(code) {
    return fetch({
        url: '/api/cultureservice/courses/findCourseNameOrCodeList?condition=' + code,
        method: 'get'
    });
}

/**
 * 查看学生列表信息
 * @param {*} params
 */
//期末成绩查看

function queryStudentFinalScorePage(params) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseManageController/queryStudentFinalScorePage',
        method: 'post',
        data: params
    });
}
//重缓考查看
function queryStudentSlowScorePage(params) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseManageController/queryStudentSlowScorePage',
        method: 'post',
        data: params
    });
}
function queryStudentScorePage(params) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseManageController/queryStudentScorePage',
        method: 'post',
        data: params
    });
}
/**
 * 查看学生列表信息
 * @param {*} params
 */
function queryScoreCountDistributePage(params) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseManageController/queryScoreCountDistributePage',
        method: 'post',
        data: params
    });
}

/**
 * 根据teachingClassID获取空白登分表标体上信息
 * @param {*} data
 */
function getBlankBasicInfo(data = {}) {
    return fetch({
        url: '/api/scoremanagementservice/enterScoreController/getBlankBasicInfo',
        method: 'post',
        data: data
    });
}

/**
 * 根据teachingClassID获取空白登分表标体上信息
 * @param {*} data
 */
function putScoreAppointImporter(data = {}) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseManageController/putScoreAppointImporter',
        method: 'post',
        data: data
    });
}
//重缓考成绩管理发布成绩成绩管理导出
 function exportTableList(data){
    let url=`/api/scoremanagementservice/scoreCourseManageController/exportTotalMarkScorePdf?teachingClassId=${data.teachingClassId}&language=${data.language}&calendarId=${data.calendarId}&sourceType=${data.sourceType}&examType=${data.examType}&oldData=${data.oldData}`
 window.open(url)
}
function queryFailedStudentInfo(data){//重緩考不及格學生名單和无成绩学生名单
    return fetch({
        url:`/api/scoremanagementservice/failedStudentController/queryFailedStudentInfo?pageNum_=${data.pageNum_}&pageSize_=${data.pageSize_}&student=${data.student}&flag=${data.flag}`,
        method:'get'
    })
}


function failedStudentExport(data,name){//无成绩不及格学生名单导出
    let url=`/api/scoremanagementservice/failedStudentController/failedStudentExport?pageNum_=${data.pageNum_}&pageSize_=${data.pageSize_}&student=${data.student}&flag=${data.flag}&grade=${data.grade}&faculty=${data.faculty}`
   window.open(url)

}
function queryFailedStudentDetail(studentId){//无成绩不及格学生详情
   return fetch({
       url:`/api/scoremanagementservice/failedStudentController/queryFailedStudentDetail?studentId=${studentId}`,
       method:'get'
   })
}

function findReCourseList(data){//获取重缓考教学班数据
    return fetch({
        url:'/api/scoremanagementservice/scoreManageController/queryScoreCourseManage',
        data,
        method:'post'
    })
}
function noPassDefaultExport(data){//不及格自定义导出
    return fetch({
        url:`/api/scoremanagementservice/failedStudentController/exportFailedStudent?flag=${data.flag}&grade=${data.grade}&faculty=${data.faculty}`,
        method:'get'
    })
}
function noPassExport(data){
    return fetch({
        url:`/api/scoremanagementservice/failedStudentController/exportFailedStudent?flag=${data.flag}&grade=${data.grade}&faculty=${data.faculty}&pageNum_=${data.pageNum_}&pageSize_=${data.pageSize_}&student=${data.student}`,
        method:'get'
    })
}
function queryFailedStudentByKey(key){
    return fetch({
        url:`/api/scoremanagementservice/failedStudentController/queryFailedStudentByKey?key=${key}`,
        method:'get'
    })
}
function unpublishScore(data){
    return fetch({
        url:`/api/scoremanagementservice/scoreCourseManageController/unpublishScore`,
        method:'post',
        params:data,
        data
    })
}
export default{
    checkCourseMessage,
    getPartPublicCourseList,
    addPartPublicCourseList,
    deletePartPublicCourseList,
    findCourseList,
    queryStudentScorePage,
    queryScoreCountDistributePage,
    getBlankBasicInfo,
    putScoreAppointImporter,
    findCourseNameOrCodeList,
    exportTableList,
    queryFailedStudentInfo,
    failedStudentExport,
    queryFailedStudentDetail,
    findReCourseList,
    queryStudentFinalScorePage,
    queryStudentSlowScorePage,
    noPassDefaultExport,
    queryFailedStudentByKey,
    noPassExport,
    unpublishScore
};
